<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>手写Promise类并绑定this</title>
  </head>
  <body></body>
  <script src="js/Hd.js"></script>
  <script>
    let p = new Hd((resolve, reject) => {
      //   setTimeout(() => {
      //   resolve("解决");
      // console.log("向军");
      reject("拒绝");
      //   }, 1000);
    })
      .then(
        (value) => {
          //   return "houdun";
          return new Hd((resolve, reject) => {
            // resolve("wfw");
            reject("fwe");
          });
        },
        (reason) => {
          //   return "houdun11";

          return new Hd((resolve, reject) => {
            resolve("houa");
            reject("wes");
          });
        }
      )
      //   .then(
      //     (value) => {
      //       console.log(value);
      //       return "身上";
      //     },
      //     (reason) => {
      //       console.log(reason);
      //       return "身边";
      //     }
      //   )
      .then(
        (value) => {
          console.log("你" + value);
        },
        (reason) => {
          console.log("rejected:" + reason);
        }
      );
  </script>
</html>
